Skip to content

[_io] Turn _IOBase.read() and write() into functions - #16583

Open
srittau wants to merge 10 commits into
python:mainfrom
srittau:iobase-read-write
Open

srittau wants to merge 10 commits into
python:mainfrom
srittau:iobase-read-write

Conversation

@srittau

@srittau srittau commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator

Originally introduced in #4912, because the docs say:

Even though IOBase does not declare read() or write() because their signatures will vary, implementations and clients should consider those methods part of the interface.

In the PR I said:

The change seems correct to me and the best solution. I am still a bit wary that this might cause unforeseen problems, but the mypy_primer output makes me optimistic. Let's try this an be prepared to revert if it causes problems.

This now seems to be the case, since ty 0.0.87 not very unreasonably complains in sub-classes (see #16551):

write: Override does not accept writes of type (...) -> Any

Since the interface may vary according to the docs, I'm not sure how useful there fields are in any case. Let's first see what primer says.

@srittau

srittau commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

pyrefly now crashes with "Stdlib missing class EllipsisType (while bootstrapping)"???

@github-actions

This comment has been minimized.

@srittau

srittau commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator Author

Removing it is probably the wrong approach as primer shows, and since we're likely just going to ignore that error code anyway. But I'll try something different.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@srittau

srittau commented Oct 21, 2026 •

Copy link
Copy Markdown
Collaborator Author

Let's wait for #16587, which should help with the primer hits.

@srittau srittau changed the title Remove IOBase.read and write [_io] Turn _IOBase.read() and write() into functions Oct 28, 2026
@github-actions

This comment has been minimized.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau
srittau marked this pull request as ready for review October 28, 2026 20:34

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant